package licode.unisop.single.platform.infrastructure.repository.dao;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import licode.unisop.single.platform.application.entity.PlatTerminalEntity;
import licode.unisop.single.platform.application.gateway.PlatTerminalDao;
import licode.unisop.single.platform.infrastructure.assembler.UniPlatformSingleAssembler;
import licode.unisop.single.platform.infrastructure.repository.mapper.PlatTerminalMapper;
import licode.unisop.single.platform.infrastructure.repository.po.PlatTerminalPO;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.io.Serializable;

/**
 * uni-platform-single
 *
 * @author licode
 * @date 2016-02-25 17:04:09
 */
@Component
public class PlatTerminalDaoImpl
        extends ServiceImpl<PlatTerminalMapper, PlatTerminalPO>
        implements PlatTerminalDao {
    @Resource
    private UniPlatformSingleAssembler uniPlatformSingleAssembler;

    @Override
    public void add(PlatTerminalEntity item) {
        super.save(uniPlatformSingleAssembler.fromPlatTerminalEntity(item));
    }

    @Override
    public void update(PlatTerminalEntity item) {
        super.updateById(uniPlatformSingleAssembler.fromPlatTerminalEntity(item));
    }

    @Override
    public void removeWithId(Serializable id) {
        super.removeById(id);
    }

    @Override
    public PlatTerminalEntity getWithId(Serializable id) {
        return uniPlatformSingleAssembler.fromPlatTerminal(super.getById(id));
    }
}
